home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
a_utils
/
perl
/
prlbkxmp.lha
/
ch6
/
pchelp
< prev
next >
Wrap
Text File
|
1991-01-08
|
2KB
|
152 lines
#!/usr/bin/perl
$TEMP = "/tmp/pchelp$$";
$DEST = 'pctech@technics.pyro.edu';
$login = $ENV{'USER'} || getlogin;
$gcos = (getpwnam($login))[6];
($name, $loc, $ext) = split(/,/, $gcos);
$EDITOR = $ENV{"VISUAL"} || $ENV{"EDITOR"} || "vi";
$PAGER = $ENV{"PAGER"} || "more";
open(FORM, ">$TEMP") || die "Can't create temp form: $!\n";
system 'clear';
chop($prompt = <<'EOP');
What do you want to do?
a) PC problem report
b) Software order request
c) Hardware order request
q) Quit
Select an option [q]:
EOP
print $prompt;
($ans = substr(<STDIN>,0,1)) =~ y/A-Z/a-z/;
{
goto problem if $ans eq 'a';
goto software if $ans eq 'b';
goto hardware if $ans eq 'c';
goto end;
}
whatnow: {
print "\nWhat now? ";
($ans = substr(<STDIN>,0,1)) =~ y/A-Z/a-z;
goto mail if $ans eq 's';
goto edit if $ans eq 'e';
goto end if $ans eq 'a';
goto end if $ans eq 'q';
goto list if $ans eq 'l';
goto help;
}
help: {
print "Options are:\n";
print " abort\n";
print " edit\n";
print " list\n";
print " send\n";
goto whatnow;
}
problem: {
print FORM <<EOF;
Name: $name
Badge #:
Location: $loc
Phone: $ext
Machine type:
Serial #:
Property #:
Description of problem:
EOF
goto edit;
} # end problem
software: {
print FORM <<EOF;
Name: $name
Badge #:
Location: $loc
Phone: $ext
Machine type:
Serial #:
Property #:
Account #:
Software requested:
Comments:
EOF
goto edit;
} # end software
hardware: {
print FORM <<EOF;
Name: $name
Badge #:
Location: $loc
Phone: $ext
Account #:
Supervisor:
Description of hardware desired (be specific):
EOF
goto edit;
} # end hardware
edit: {
close FORM;
print "\nInvoking editor, $EDITOR...\n";
sleep (1);
system $EDITOR, $TEMP;
goto whatnow;
}
mail: {
print "\nMailing to $DEST...\n";
system "/bin/mail $DEST </tmp/pchelp$$";
goto end;
}
list: {
system $PAGER, "/tmp/pchelp$$";
goto whatnow;
}
end: {
unlink $TEMP;
}